package com.example.yqzs.controller;

import com.example.yqzs.pojo.User;
import com.example.yqzs.pojo.UserExample;
import com.example.yqzs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class LoginController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login")
    public String login(){
        return "login";
    }

    @RequestMapping(value = "/index")
    public String index(){
        return "index";
    }

    @RequestMapping(value = "/userinfo")
    public String userinfo(Model m){
        UserExample example = new UserExample();
        List<User> userList = userService.getUser(example);
        System.out.println(userList.toString());
        m.addAttribute("userLister", userList);
        return "userinfo";
    }
}
